package filesystem;
import java.util.Date;


public class Link extends FSElement 
{
	private FSElement target = null;
	
	public Link(FSElement target,
				String name, 
				String owner, 
				Directory parent,
				Date created)
	{
		setName(name);
		setOwner(owner);
		setParent(parent);
		setCreated(created);
		setLastModified(created);
		setSizeCalculator(new FileSizeCalculator());
		setSize(1);
		setTarget(target);		
	}

	@Override
	public String getInfo(String prefix) 
	{
		String result = "";		
		result = prefix + "Link: " + getName() + " to " + getTarget().getName()+ "\tOwner: " + 
			getOwner() + "\tSize: " + getSize() + "\tCreated: " +getCreated().toString() + 
			"\tModified: " + getLastModified().toString() + "\n";	
		return result;
		
	}

	public void setTarget(FSElement target) 
	{
		this.target = target;
	}

	public FSElement getTarget() {
		return target;
	}

}
